package com.lv.service.model

import com.lv.common.base.BaseViewModel
import com.lv.common.network.model.DataResult
import com.lv.service.net.ADStatisticsReqBody
import com.lv.service.net.BindPhoneReqBody
import com.lv.service.net.BrandHotBody
import com.lv.service.net.ClientHFRReqBody
import com.lv.service.net.CollectOrAttentionBody
import com.lv.service.net.CompanyReqBody
import com.lv.service.net.KeyLoginReqBody
import com.lv.service.net.LoginByCodeReqBody
import com.lv.service.net.LoginByPassWordReqBody
import com.lv.service.net.PageBrandBody
import com.lv.service.net.PageCategoryBody
import com.lv.service.net.PageIdBody
import com.lv.service.net.PageNameIdBody
import com.lv.service.net.RegistUserReqBody
import com.lv.service.net.SearchPageBody
import com.lv.service.net.SendCodeBody
import com.lv.service.net.ThreedLoginReqBody
import com.lv.service.net.UserDeleteReqBody
import com.lv.service.net.VerifyCodeBody
import com.lv.service.net.VerifyPhoneReqBody
import com.lv.service.network.BaseYgxRsp
import okhttp3.MultipartBody
import okhttp3.RequestBody

/**
 * 作者： ygx
 * 创建日期：2023/2/28 5:09 PM
 * 签名： 天行健，君子以自强不息；地势坤，君子以厚德载物。
 * -    _              _           _     _   ____  _             _ _
 * -   / \   _ __   __| |_ __ ___ (_) __| | / ___|| |_ _   _  __| (_) ___
 * -  / _ \ | '_ \ / _` | '__/ _ \| |/ _` | \___ \| __| | | |/ _` | |/ _ \
 * - / ___ \| | | | (_| | | | (_) | | (_| |  ___) | |_| |_| | (_| | | (_) |
 * -/_/   \_\_| |_|\__,_|_|  \___/|_|\__,_| |____/ \__|\__,_|\__,_|_|\___/
 * <p>
 * You never know what you can do until you try !
 * ----------------------------------------------------------------
 * 描述：
 */
class ServiceViewModel(private val resource: IServiceResource) : BaseViewModel() {
    suspend fun login(body: LoginByPassWordReqBody): DataResult<BaseYgxRsp> = resource.login(body)

    suspend fun loginByCode(body: LoginByCodeReqBody): DataResult<BaseYgxRsp> =
        resource.loginByCode(body)

    suspend fun latestUser() = resource.latestUser()

    /**
     * 检查更新
     */
    suspend fun findVersionUpdate() = resource.findVersionUpdate()

    suspend fun findPros(map: Map<String, String>) = resource.findPros(map)

    /**
     * 注册
     */
    suspend fun registUser(body: RegistUserReqBody): DataResult<BaseYgxRsp> =
        resource.registUser(body)

    /**
     * 一键登录
     */
    suspend fun keyToLand(reqBody: KeyLoginReqBody): DataResult<BaseYgxRsp> =
        resource.keyToLand(reqBody)

    /**
     * 三方登录
     */
    suspend fun threeLanding(reqBody: ThreedLoginReqBody): DataResult<BaseYgxRsp> =
        resource.threeLanding(reqBody)

    /**
     * 绑定手机号
     */
    suspend fun bindingUser(reqBody: BindPhoneReqBody): DataResult<BaseYgxRsp> =
        resource.bindingUser(reqBody)

    /**
     * 验证手机号
     */
    suspend fun verifyPhone(body: VerifyPhoneReqBody): DataResult<BaseYgxRsp> =
        resource.verifyPhone(body)

    /**
     * 完善信息
     */
    suspend fun updateUser(map: Map<String, RequestBody>): DataResult<BaseYgxRsp> =
        resource.updateUser(map)

    /**
     * 发送短信验证
     */
    suspend fun sendCode(body: SendCodeBody) = resource.sendCode(body)

    /**
     * 验证验证码
     */
    suspend fun verifyCode(body: VerifyCodeBody) = resource.verifyCode(body)

    /**
     *  广告统计
     */
    suspend fun saveAdStatistics(body: ADStatisticsReqBody): DataResult<BaseYgxRsp> =
        resource.saveAdStatistics(body)

    /**
     * 意见反馈
     */
    suspend fun feedback(text: String): DataResult<BaseYgxRsp> = resource.feedback(text)

    /**
     * 修改个人信息
     */
    suspend fun updateMyLogo(
        map: Map<String, RequestBody>, part: List<MultipartBody.Part>
    ): DataResult<BaseYgxRsp> = resource.updateMyLogo(map, part)

    /**
     * 修改个人信息
     */
    suspend fun updateMyMessage(body: Map<String, RequestBody>): DataResult<BaseYgxRsp> =
        resource.updateMyMessage(body)

    /**
     * 发送短信验证-修改公司
     */
    suspend fun sendCodeCom(body: SendCodeBody) = resource.sendCodeCom(body)

    /**
     * 验证验证码-修改公司
     */
    suspend fun verifyCodeCom(body: VerifyCodeBody) = resource.verifyCodeCom(body)

    /**
     * 注销个人信息
     */
    suspend fun deleteUser(body: UserDeleteReqBody): DataResult<BaseYgxRsp> =
        resource.deleteUser(body)

    /**
     * 修改个人信息-业务员修改公司
     */
    suspend fun updatePasswordOrPhone(body: CompanyReqBody): DataResult<BaseYgxRsp> =
        resource.updatePasswordOrPhone(body)


    /**
     * 查找个数
     */
    suspend fun findCount(map: Map<String, String>) = resource.findCount(map)


    /**
     * 查找单个期数
     */
    suspend fun findOnePdAndCa(map: Map<String, String>): DataResult<BaseYgxRsp> =
        resource.findOnePdAndCa(map)


    /**
     *  查看小程序或进件信息
     */
    suspend fun findOneSubmit(map: Map<String, String>): DataResult<BaseYgxRsp> =
        resource.findOneSubmit(map)

    /**
     *  亨富然基础信息
     */
    suspend fun findhengPros(map: Map<String, String>): DataResult<BaseYgxRsp> =
        resource.findhengPros(map)

    /**
     * 亨富然开户
     */
    suspend fun saveHengCompany(body: ClientHFRReqBody): DataResult<BaseYgxRsp> =
        resource.saveHengCompany(body)

    /**
     * 首页头
     */
    suspend fun homePage(map: Map<String, String>): DataResult<BaseYgxRsp> = resource.homePage(map)

    /**
     * 首页尾
     */
    suspend fun bottomPage(
        page: Int, pageSize: Int, map: Map<String, String>
    ): DataResult<BaseYgxRsp> = resource.bottomPage(page, pageSize, map)

    /**
     * 商品详情
     */
    suspend fun findOneGoods(spuid: String): DataResult<BaseYgxRsp> =
        resource.findOneGoods(spuid)

    /**
     * 商品详情底部推荐
     */
    suspend fun findGoodsbotton(
        page: Int, pageSize: Int, map: Map<String, String>
    ): DataResult<BaseYgxRsp> = resource.findGoodsbotton(page, pageSize, map)

    /**
     * 收藏商品/关注公司
     */
    suspend fun collectOrAttention(body: CollectOrAttentionBody): DataResult<BaseYgxRsp> =
        resource.collectOrAttention(body)

    /**
     * 商品详情页推荐商品和相似商品
     */
    suspend fun findGoodsRemark(map: Map<String, String>): DataResult<BaseYgxRsp> =
        resource.findGoodsRemark(map)

    /**
     * 公司详情
     */
    suspend fun findOneCompany(map: Map<String, String>): DataResult<BaseYgxRsp> =
        resource.findOneCompany(map)

    /**
     * 详情页访问记录
     */
    suspend fun findCompanyAccess(map: Map<String, String>): DataResult<BaseYgxRsp> =
        resource.findCompanyAccess(map)

    /**
     * 公司产品
     */
    suspend fun companyGoods(
        page: Int, pageSize: Int, map: Map<String, String>
    ): DataResult<BaseYgxRsp> = resource.companyGoods(page, pageSize, map)

    /**
     * 主推商品
     */
    suspend fun promoteGoods(
        page: Int, pageSize: Int, map: Map<String, String>
    ): DataResult<BaseYgxRsp> = resource.promoteGoods(page, pageSize, map)

    /**
     * 店铺产品页
     */
    suspend fun CompanyDetails(
        page: Int, pageSize: Int, map: Map<String, String>
    ): DataResult<BaseYgxRsp> = resource.CompanyDetails(page, pageSize, map)

    /**
     * 搜索引导页
     */
    suspend fun searchPagetally(
        page: Int, pageSize: Int, map: Map<String, String>
    ): DataResult<BaseYgxRsp> = resource.searchPagetally(page, pageSize, map)

    /**
     * 搜索结果页
     */
    suspend fun searchPage(body: SearchPageBody): DataResult<BaseYgxRsp> = resource.searchPage(body)


    /**
     * 特惠顶部
     */
    suspend fun specialOfferTop(): DataResult<BaseYgxRsp> = resource.specialOfferTop()

    /**
     * 特惠
     */
    suspend fun specialOffer(body: PageCategoryBody): DataResult<BaseYgxRsp> =
        resource.specialOffer(body)

    /**
     * 新公司
     */
    suspend fun newCompany(page: Int, pageSize: Int): DataResult<BaseYgxRsp> =
        resource.newCompany(page, pageSize)

    /**
     * 查询banner
     */
    suspend fun findAllBanner(code: String): DataResult<BaseYgxRsp> = resource.findAllBanner(code)

    /**
     * 品牌工厂顶部
     */
    suspend fun brandFacTop(body: PageIdBody): DataResult<BaseYgxRsp> = resource.brandFacTop(body)

    /**
     * 品牌工厂
     */
    suspend fun brandFac(body: PageBrandBody): DataResult<BaseYgxRsp> = resource.brandFac(body)

    /**
     * 必找工厂
     */
    suspend fun mustFac(body: PageBrandBody): DataResult<BaseYgxRsp> = resource.mustFac(body)

    /**
     * 本地工厂
     */
    suspend fun localFac(body: PageBrandBody): DataResult<BaseYgxRsp> = resource.localFac(body)

    /**
     * 批发好货
     */
    suspend fun saleByBulk(body: PageNameIdBody): DataResult<BaseYgxRsp> = resource.saleByBulk(body)

    /**
     * 品牌热卖
     */
    suspend fun brandHot(body: BrandHotBody): DataResult<BaseYgxRsp> = resource.brandHot(body)

    /**
     * 品牌热卖查看更多
     */
    suspend fun manybrand(body: BrandHotBody): DataResult<BaseYgxRsp> = resource.manybrand(body)

    /**
     * 附近商品
     */
    suspend fun localGoods(body: PageBrandBody): DataResult<BaseYgxRsp> = resource.localGoods(body)

    /**
     * 热销 顶部
     */
    suspend fun salehotTop(): DataResult<BaseYgxRsp> = resource.salehotTop()

    /**
     * 热销
     */
    suspend fun salehot(body: PageCategoryBody): DataResult<BaseYgxRsp> = resource.salehot(body)
}